package o;

import android.app.Activity;
import android.text.TextUtils;
import com.huawei.appgallery.foundation.ui.framework.titleframe.bean.BaseTitleBean;
import java.util.HashMap;
import java.util.Map;

public class cjd {
    private static Map<String, Class<? extends BaseTitleBean>> ˋ = new HashMap();
    private static Map<String, Class<? extends cjf>> ॱ = new HashMap();

    public static void ˏ(String str, Class<? extends cjf> cls) {
        ॱ.put(str, cls);
    }

    public static void ˎ(String str, Class<? extends BaseTitleBean> cls) {
        ˋ.put(str, cls);
    }

    public static cjf ˋ(Activity activity, cje o_cje) {
        if (o_cje == null) {
            Logger.ˋ("TitleRegister", "getTitle titleInfo == null");
            return null;
        }
        cjf o_cjf;
        String ˎ = o_cje.ˎ();
        BaseTitleBean ˏ = o_cje.ˏ();
        if (TextUtils.isEmpty(ˎ) || activity == null || ˏ == null) {
            Logger.e("TitleRegister", "getTitle, titleType: " + ˎ + ", titleBean: " + ˏ);
            o_cjf = null;
        } else {
            Class cls = (Class) ॱ.get(ˎ);
            if (cls != null) {
                try {
                    o_cjf = (cjf) cls.getConstructor(new Class[]{Activity.class, BaseTitleBean.class}).newInstance(new Object[]{activity, ˏ});
                } catch (Throwable e) {
                    Logger.ˋ("TitleRegister", "getTitle NoSuchMethodException, titleType: " + ˎ, e);
                    o_cjf = null;
                } catch (Throwable e2) {
                    Logger.ˋ("TitleRegister", "getTitle InstantiationException, titleType: " + ˎ, e2);
                    o_cjf = null;
                } catch (Throwable e22) {
                    Logger.ˋ("TitleRegister", "getTitle IllegalAccessException, titleType: " + ˎ, e22);
                    o_cjf = null;
                } catch (Throwable e222) {
                    Logger.ˋ("TitleRegister", "getTitle IllegalArgumentException, titleType: " + ˎ, e222);
                    o_cjf = null;
                } catch (Throwable e2222) {
                    Logger.ˋ("TitleRegister", "getTitle InvocationTargetException, titleType: " + ˎ, e2222);
                    o_cjf = null;
                }
            } else {
                Logger.e("TitleRegister", "getTitle titleClass == null, titleType: " + ˎ);
                o_cjf = null;
            }
        }
        return o_cjf;
    }

    public static BaseTitleBean ˊ(String str) {
        if (TextUtils.isEmpty(str)) {
            Logger.e("TitleRegister", "getTitle titleType isEmpty, titleType: " + str);
        } else {
            Class cls = (Class) ˋ.get(str);
            if (cls != null) {
                try {
                    return (BaseTitleBean) cls.getConstructor(new Class[0]).newInstance(new Object[0]);
                } catch (Throwable e) {
                    Logger.ˋ("TitleRegister", "getTitleBean NoSuchMethodException, titleType: " + str, e);
                    return null;
                } catch (Throwable e2) {
                    Logger.ˋ("TitleRegister", "getTitleBean InstantiationException, titleType: " + str, e2);
                    return null;
                } catch (Throwable e22) {
                    Logger.ˋ("TitleRegister", "getTitleBean IllegalAccessException, titleType: " + str, e22);
                    return null;
                } catch (Throwable e222) {
                    Logger.ˋ("TitleRegister", "getTitleBean IllegalArgumentException, titleType: " + str, e222);
                    return null;
                } catch (Throwable e2222) {
                    Logger.ˋ("TitleRegister", "getTitleBean InvocationTargetException, titleType: " + str, e2222);
                    return null;
                }
            }
            Logger.e("TitleRegister", "getTitleBean titleClass == null, titleType: " + str);
        }
        return null;
    }
}
